package com.wit.witmg.api;


import com.wit.witmg.service.ITEquipService;
import com.wit.witmg.service.ITOrgService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @author bob
 * @since 2024-12-10
 */
@RestController
@RequestMapping("equip")
@Api(tags = "设备API")
public class EquipController {
    @Resource
    private ITEquipService service;

    @ApiOperation("添加")
    @PostMapping("add")
    public Object add(HttpServletRequest request,
                      @RequestParam("json") String json) {
        return service.add(request,json);
    }

    //参数：sid场地编号，返回sid以参数开头并包含参数的数据；oid部门编号，返回oid以参数开头并包含参数的数据；bn模糊查询（前端支持二维码识别），id返回单条数据，常用于连表查询；
    @ApiOperation("获取")
    @PostMapping("get")
    public Object get(HttpServletRequest request,
                      @RequestParam(value = "sid",required = false) Integer sid,
                      @RequestParam(value = "oid",required = false) Integer oid,
                      @RequestParam(value = "bn",required = false) String bn,
                      @RequestParam(value = "id",required = false) Integer id) {
        return service.get(request,sid,oid,bn,id);
    }

    @ApiOperation("删除")
    @PostMapping("del")
    public Object del(HttpServletRequest request,
                      @RequestParam("id") Integer id) {
        return service.del(request,id);
    }
}
